<!--********************************************************************
* Copyright© 2000 - 2025 SuperMap Software Co.Ltd. All rights reserved.
*********************************************************************-->
<!--********************************************************************
* 该示例需要引入 
* vue-iclient (https://github.com/SuperMap/vue-iclient)
* mapbox-gl-enhance (https://iclient.supermap.io/web/libs/mapbox-gl-js-enhance/1.12.1-12/mapbox-gl-enhance.js)
*********************************************************************-->
<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title data-i18n="resources.title_componentsTianditu_route_Vue"></title>
    <script type="text/javascript" include="vue" src="../js/include-web.js"></script>
    <script include="iclient-mapboxgl-vue,mapbox-gl-enhance" src="../../dist/mapboxgl/include-mapboxgl.js"></script>
    <style>
      #main {
        margin: 0 auto;
        width: 100%;
        height: 100%;
      }
      .mapboxgl-ctrl button:not(:disabled):hover {
        background-color: #269ff0;
      }
    </style>
  </head>

  <body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;">

      <div id="main" style="position: absolute">
        <sm-web-map :map-options="mapOptions">
          <!-- 天地图路线查询组件: sm-tdt-route, 参数： token, busUrl, carUrl, searchUrl, position, theme -->
          <sm-tdt-route position="top-left" :data="{tk:tk}" :collapsed="false"></sm-tdt-route>
        </sm-web-map>
      </div>

    <script>
      new Vue({
        el: '#main',
        data() {
          return {
            tk: '1d109683f4d84198e37a38c442d68311',
            mapOptions: {
              center: [126.64318, 45.74141],
              zoom: 11,
              style: {
                version: 8,
                sources: {
                  baseLayer: {
                    type: 'raster',
                    tiles: [
                      'https://t0.tianditu.gov.cn/img_w/wmts?tk=1d109683f4d84198e37a38c442d68311&service=WMTS&request=GetTile&version=1.0.0&style=default&tilematrixSet=w&format=tiles&width=256&height=256&layer=img&tilematrix={z}&tilerow={y}&tilecol={x}',
                    ],
                    tileSize: 256
                  },
                  labelLayer: {
                    type: 'raster',
                    tiles: [
                      'https://t0.tianditu.gov.cn/cia_w/wmts?tk=1d109683f4d84198e37a38c442d68311&service=WMTS&request=GetTile&version=1.0.0&style=default&tilematrixSet=w&format=tiles&width=256&height=256&layer=cia&tilematrix={z}&tilerow={y}&tilecol={x}',
                    ],
                    tileSize: 256
                  }
                },
                layers: [
                  {
                    id: 'baseLayer',
                    type: 'raster',
                    source: 'baseLayer',
                    minzoom: 0,
                    maxzoom: 18
                  },
                  {
                    id: 'labelLayer',
                    type: 'raster',
                    source: 'labelLayer',
                    minzoom: 0,
                    maxzoom: 18
                  }
                ]
              },
              renderWorldCopies: false
            }
          };
        }
      });
    </script>
  </body>
</html>
